﻿using MyOS.Models;

namespace MyOS
{
    public class BlockQueue
    {
        static BlockQueue()
        {
            PcbStart = null;
            PcbEnd = null;
        }

        public static PCBModel PcbStart { set; get; } //第一个进程控制块
        public static PCBModel PcbEnd { set; get; } //最后一个进程控制块

        /**
         * 添加新的进程
         */
        public static void Add(PCBModel pcb)
        {
            pcb.State = emState.block;
            if (PcbEnd == null && PcbStart == null)
            {
                PcbStart = pcb;
                PcbEnd = pcb;
            }
            else
            {
                PcbEnd.Next = pcb;
                PcbEnd = pcb;
            }

            PcbEnd.Next = null;
        }
    }
}